/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bff.slimserver.musicjukebox.ui.components;

import com.bff.bjj.ui.component.BJJPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.LayoutManager;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.UIManager;

/**
 *
 * @author bfindeisen
 */
public class SongInfoPlayerPanel extends BJJPanel {

    int curvature = 20;
    Color panelColor = UIManager.getColor("Panel.background");

    public SongInfoPlayerPanel() {
        this(new FlowLayout(FlowLayout.LEFT));
    }

    public SongInfoPlayerPanel(LayoutManager layout) {
        super(layout);

        if (!UIManager.getLookAndFeel().getName().startsWith("Nimbus")) {
            setOpaque(true);
            setBorder(BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(),
                    BorderFactory.createLoweredBevelBorder()));
        } else {
            setOpaque(false);
            setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        }
    }

    /*
    public SongInfoPlayerPanel(LayoutManager layout, int curvature) {
    super(layout);
    setCurvature(curvature);
    setBorder(new EmptyBorder(1, 5, 1, 5));
    setOpaque(false);
    }

    public SongInfoPlayerPanel(int curvature) {
    this(new FlowLayout(FlowLayout.LEFT), curvature);
    }

    public void setBackground(Color c) {
    setPanelColor(c);
    }
*/
    public void setPanelColor(Color c) {
        panelColor = c;
        repaint();
    }

    public void setCurvature(int curvature) {
        this.curvature = curvature;
        repaint();
    }

    /*
    protected void paintComponent(Graphics g) {
    int width = getWidth();
    int height = getHeight();

    // Paint a rounded rectangle in the background.
    g.setColor(getBackground());
    g.fill3DRect(0, 0, width, height, true);

    // Now call the superclass behavior to paint the foreground.
    super.paintComponent(g);
    }
     */

    /*
    public void paintComponent(Graphics g) {
    //super.paintComponent(g);
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
    RenderingHints.VALUE_ANTIALIAS_ON);
    //g.clearRect(0, 0, getPreferredSize().width, getPreferredSize().height);
    g2.setColor(panelColor.darker());
    //g2.drawRoundRect(0, 0, getPreferredSize().width, getPreferredSize().height,
    //curvature, curvature);
    g2.fillRoundRect(0, 0, getWidth(), getHeight(), curvature, curvature);
    //g2.draw3DRect(0, 0, getPreferredSize().width, getPreferredSize().height, false);

    g2.setColor(panelColor);
    //g2.fillRoundRect(1, 1, getPreferredSize().width - 2, getPreferredSize().height - 2,
    //curvature, curvature);
    g2.fillRoundRect(1, 1, getWidth() - 2, getHeight() - 2, curvature, curvature);
    //g2.fill3DRect(2, 2, getPreferredSize().width, getPreferredSize().height, true);
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    super.paintComponent(g);
    }
     */
    public static void main(String[] args) {
        JFrame f = new JFrame();
        f.setLayout(new BorderLayout());
        JPanel p = new JPanel(new BorderLayout());

        SongInfoPlayerPanel rp = new SongInfoPlayerPanel(new FlowLayout());

        rp.setPreferredSize(new Dimension(300, 100));
        //rp.setBackground(ColorProperties.PLAYER_INSERT);
        rp.add(new JLabel("Test"));

        p.add(rp, BorderLayout.CENTER);
        f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        f.add(p, BorderLayout.CENTER);
        f.setSize(new Dimension(700, 300));
        f.setVisible(true);


    }
}
